Move a function around
authorMatthias Clasen <mclasen@redhat.com>
Sun, 10 Nov 2013 00:27:53 +0000 (19:27 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 10 Nov 2013 00:27:53 +0000 (19:27 -0500)
_Gtk_file_chooser_label_for_file is not actually
used in gtkfilechooserdefault.c anymore, so move
it to a better place.

gtk/gtkfilechooserdefault.c
gtk/gtkfilechooserdefault.h
gtk/gtkfilechooserutils.c
gtk/gtkfilechooserutils.h

index 6458d9a61a43a138022d7b905413d12ca4583bb1..e573534f080d96598425befce6454a5cedff7f07 100644 (file)
@@ -896,62 +896,6 @@ set_preview_widget (GtkFileChooserDefault *impl,
   update_preview_widget_visibility (impl);
 }
 
-/* FIXME: GtkFileSystem needs a function to split a remote path
- * into hostname and path components, or maybe just have a 
- * gtk_file_system_path_get_display_name().
- *
- * This function is also used in gtkfilechooserbutton.c
- */
-gchar *
-_gtk_file_chooser_label_for_file (GFile *file)
-{
-  const gchar *path, *start, *end, *p;
-  gchar *uri, *host, *label;
-
-  uri = g_file_get_uri (file);
-
-  start = strstr (uri, "://");
-  if (start)
-    {
-      start += 3;
-      path = strchr (start, '/');
-      if (path)
-        end = path;
-      else
-        {
-          end = uri + strlen (uri);
-          path = "/";
-        }
-
-      /* strip username */
-      p = strchr (start, '@');
-      if (p && p < end)
-        start = p + 1;
-  
-      p = strchr (start, ':');
-      if (p && p < end)
-        end = p;
-  
-      host = g_strndup (start, end - start);
-  
-      /* Translators: the first string is a path and the second string 
-       * is a hostname. Nautilus and the panel contain the same string 
-       * to translate. 
-       */
-      label = g_strdup_printf (_("%1$s on %2$s"), path, host);
-  
-      g_free (host);
-    }
-  else
-    {
-      label = g_strdup (uri);
-    }
-  
-  g_free (uri);
-
-  return label;
-}
-
 /* Callback used when the "New Folder" button is clicked */
 static void
 new_folder_button_clicked (GtkButton             *button,
index 3c90de2100a5742c4047585fceba396891bdc970..8b2f3f3ae1dfde27253162d7d58bf43e34813a42 100644 (file)
@@ -33,8 +33,6 @@ typedef struct _GtkFileChooserDefault      GtkFileChooserDefault;
 GType      _gtk_file_chooser_default_get_type (void) G_GNUC_CONST;
 GtkWidget *_gtk_file_chooser_default_new      (void);
 
-gchar *    _gtk_file_chooser_label_for_file   (GFile *file);
-
 G_END_DECLS
 
 #endif /* __GTK_FILE_CHOOSER_DEFAULT_H__ */
index 2b2542cd7b70aef063d1b18f63792ba27d6c0df8..bc7bb49622d94bd631047e143de6831670fcbab3 100644 (file)
@@ -449,3 +449,53 @@ _gtk_file_chooser_get_settings_for_widget (GtkWidget *widget)
 
   return settings;
 }
+
+gchar *
+_gtk_file_chooser_label_for_file (GFile *file)
+{
+  const gchar *path, *start, *end, *p;
+  gchar *uri, *host, *label;
+
+  uri = g_file_get_uri (file);
+
+  start = strstr (uri, "://");
+  if (start)
+    {
+      start += 3;
+      path = strchr (start, '/');
+      if (path)
+        end = path;
+      else
+        {
+          end = uri + strlen (uri);
+          path = "/";
+        }
+
+      /* strip username */
+      p = strchr (start, '@');
+      if (p && p < end)
+        start = p + 1;
+
+      p = strchr (start, ':');
+      if (p && p < end)
+        end = p;
+
+      host = g_strndup (start, end - start);
+      /* Translators: the first string is a path and the second string 
+       * is a hostname. Nautilus and the panel contain the same string 
+       * to translate. 
+       */
+      label = g_strdup_printf (_("%1$s on %2$s"), path, host);
+
+      g_free (host);
+    }
+  else
+    {
+      label = g_strdup (uri);
+    }
+
+  g_free (uri);
+
+  return label;
+}
+
index ad9ef364b51eed0a0d8000cf9d28a8549ed1627f..21b98b029791502ce876c6b42d08b9edf16d23f2 100644 (file)
@@ -54,6 +54,8 @@ GList *_gtk_file_chooser_extract_recent_folders (GList *infos);
 
 GSettings *_gtk_file_chooser_get_settings_for_widget (GtkWidget *widget);
 
+gchar * _gtk_file_chooser_label_for_file (GFile *file);
+
 G_END_DECLS
 
 #endif /* __GTK_FILE_CHOOSER_UTILS_H__ */